package com.rw.coco.api.data.model;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Objects;

/**
 * 角色的属性对象
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class CharacterPropertyModel {
    /**
     * 角色ID
     */
    protected Integer characterId;

    /**
     * 角色的属性名
     */
    protected String propertiesName;

    /**
     * 角色的属性值
     */
    protected Integer propertiesValue;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CharacterPropertyModel that = (CharacterPropertyModel) o;
        return Objects.equals(characterId, that.characterId) && Objects.equals(propertiesName, that.propertiesName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(characterId, propertiesName);
    }

    public static CharacterPropertyModel of(Integer characterId, String propertiesName) {
        return new CharacterPropertyModel(characterId, propertiesName, null);
    }
}
